Diferenças

Aqui você vê as diferenças entre duas revisões dessa página.

listas [15/03/2010 23:55]
tjpp removida
listas [10/07/2010 10:32] (atual)
tjpp
Linha 1: Linha 1:
-====== Caminhante Aleatório em 2D ======+====== Listas de Exercícios ======
-Caminhante aleatório em 2 dimensões. Os últimos passos  são mostrados também como a cauda do caminhante. Clique na figura para iniciar. Esta simulação usa condições periódicas de contorno (o caminhante sai por um dos lados e aparece no outro).   
-<html> +  - [[listas:lista1|1ª Lista]] 
-<head> +  - [[listas:lista2|2ª Lista]] 
-<title>Caminhada Aleatória</title>       +  - [[listas:lista3|3ª Lista]] 
-<script language="javascript" src="http://profs.if.uff.br/Processing/init.js"></script> +  - [[listas:lista4|4ª Lista]]
-<script language="javascript" src="http://profs.if.uff.br/Processing/processing.js"></script> +
-</head> +
-<body>+
-<script type="application/processing">+====== Provas ======
-int num = 1000; +  - [[listas:prova1|1ª Prova]] 
-int range = 2; +  
-int tail = 8; +{{tag>exercicios}}
-float[] ax = new float[num]+
-float[] ay = new float[num];  +
- +
-void setup()  +
-{ +
-  size(200, 200); +
-  for(int i=0; i<num; i++) { +
-    ax[i] = width/2; +
-    ay[i] = height/2; +
-  } +
-  noLoop(); +
-+
- +
-void draw()  +
-+
-  background(51); +
-   +
-  // Shift all elements 1 place to the left +
-  for(int i=1; i<num; i++) { +
-    ax[i-1] = ax[i]; +
-    ay[i-1] = ay[i]; +
-  } +
- +
-  // Put a new value at the end of the array +
-  ax[num-1] += random(-range, range); +
-  ay[num-1] += random(-range, range); +
- +
-  // Constrain all points to the screen +
-  //ax[num-1] = constrain(ax[num-1], 0, width); +
-  //ay[num-1] = constrain(ay[num-1], 0, height); +
-  ax[num-1] = (ax[num-1]+width)%width; +
-  ay[num-1] = (ay[num-1]+height)%height; +
-  //az[num-1] = (az[num-1]+depth)%depth; +
-  //ax[num-1] = constrain(ax[num-1], 0, width); +
-  // Draw a line connecting the points +
- /* for(int i=1; i<num; i++) {     +
-    float val = float(i)/num * 204.0 + 51; +
-    stroke(val); +
-    line(ax[i-1], ay[i-1], ax[i], ay[i]); +
-  } */ +
- +
-  stroke(255); +
-  for(int i=num-1;i>num-tail;i--) { +
-    float radius=(i-num+tail+2); +
-    ellipse(ax[i],ay[i],radius,radius); +
-  }  +
-} +
- +
-void mousePressed()  +
-+
-  loop(); +
-+
-</script><canvas width="200px" height="200px"></canvas> +
- +
-</html> +
- +
-~~DISCUSSION~~+
 
listas.1268708158.txt.gz · Última modificação: 15/03/2010 23:55 por tjpp     Voltar ao topo
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki Design by Chirripó